#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    QPushButton* button = new QPushButton(this);
    button->setText("按钮");
    button->move(320,250);
    connect(button,&QPushButton::clicked,this,&Widget::handleClicked);
    connect(this,&Widget::mySignal,this,&Widget::handlemySignal);
//    emit mySignal();
}

void Widget::handleClicked()
{
//    setWindowTitle("button already clicked");
    emit mySignal("regaerg");
}

Widget::~Widget()
{
    delete ui;
}

void Widget::handlemySignal(const QString& text)
{
    setWindowTitle(text);
}

void Widget::on_pushButton_clicked()
{
    this->setWindowTitle("finsh");
}

void Widget::on_pushButton_2_clicked()
{
    handlemySignal("erggethry");
}

